fix: microphone permission for MacOS#3183
Merged
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a platform check to skip using the permission_handler microphone permission request on macOS, relying instead on the record package’s own permission handling, and declares the required microphone usage description in the macOS Info.plist. Sequence diagram for updated microphone permission handlingsequenceDiagram
actor User
participant ChannelParametersWidget
participant PermissionHandler
participant RecordPlugin
participant MacOSSystem
participant OtherOSSystem
User->>ChannelParametersWidget: Tap inBuiltMIC option
activate ChannelParametersWidget
ChannelParametersWidget->>ChannelParametersWidget: onChangedMicSelection(value)
alt Platform isMacOS
ChannelParametersWidget-->>PermissionHandler: Skip microphone.request()
ChannelParametersWidget->>RecordPlugin: StartRecording()
RecordPlugin->>MacOSSystem: RequestMicrophoneAccess
MacOSSystem-->>RecordPlugin: GrantOrDeny
RecordPlugin-->>ChannelParametersWidget: RecordingStatus
else Platform is not MacOS
ChannelParametersWidget->>PermissionHandler: Permission.microphone.request()
PermissionHandler-->>OtherOSSystem: RequestMicrophoneAccess
OtherOSSystem-->>PermissionHandler: GrantOrDeny
PermissionHandler-->>ChannelParametersWidget: PermissionStatus
ChannelParametersWidget->>RecordPlugin: StartRecording()
RecordPlugin-->>ChannelParametersWidget: RecordingStatus
end
deactivate ChannelParametersWidget
Class diagram for ChannelParametersWidget microphone permission changeclassDiagram
class ChannelParametersWidget {
}
class _ChannelParametersState {
+bool isInBuiltMICSelected
+void onChangedInBuiltMic(bool value)
}
ChannelParametersWidget --> _ChannelParametersState : creates
class Platform {
+static bool isMacOS
}
class Permission {
+static Permission microphone
+Future request()
}
class RecordPlugin {
+Future startRecording()
}
_ChannelParametersState ..> Platform : checks_platform
_ChannelParametersState ..> Permission : requests_mic_permission_non_macos
_ChannelParametersState ..> RecordPlugin : starts_recording
note for _ChannelParametersState "onChangedInBuiltMic(value) {
if (!Platform.isMacOS) {
await Permission.microphone.request()
}
setState(updateMicSelection)
}"
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The platform check around
Permission.microphone.request()is hardcoded to only skip macOS; consider centralizing permission handling (e.g., in a service or utility) so that platform-specific behavior is defined in one place instead of directly inside the widget. - The result of
Permission.microphone.request()is ignored; if this affects UI behavior (e.g., enabling the oscilloscope), consider handling denied/permanentlyDenied states so the widget can react appropriately when permission is not granted.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The platform check around `Permission.microphone.request()` is hardcoded to only skip macOS; consider centralizing permission handling (e.g., in a service or utility) so that platform-specific behavior is defined in one place instead of directly inside the widget.
- The result of `Permission.microphone.request()` is ignored; if this affects UI behavior (e.g., enabling the oscilloscope), consider handling denied/permanentlyDenied states so the widget can react appropriately when permission is not granted.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Build StatusBuild successful. APKs to test: https://github.com/fossasia/pslab-app/actions/runs/24501238903/artifacts/6469666612. Screenshots |
Contributor
Author
|
Platform.isMacOS is not supported by web version, so we check before if we aren't in web with !kIsWeb (so we use lazy evaluation of flutter) and after if we aren't in MacOS Tested on MacOS and Web and it works |
CloudyPadmal
approved these changes
Apr 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







-1_instruments_screen.png?raw=true)
-2_nav_drawer.png?raw=true)
-3_accelerometer.png?raw=true)
-4_power_source.png?raw=true)
-5_multimeter.png?raw=true)
-6_wave_generator.png?raw=true)
-7_oscilloscope.png?raw=true)
Fixes #3181
Changes
Add exclusion for MacOS platform in permission handler because
permission_handlerlibrary doesn't support MacOS. Microphone permissions is already managed by the record library, as marked in documentation.Screenshots / Recordings
N/A
Checklist:
constants.dartor localization files instead of hard-coded values.dart formator the IDE formatter.flutter analyzeand tests run influtter test.Summary by Sourcery
Handle microphone permission behavior differently on macOS to align with platform support and existing recording library handling.
Bug Fixes:
Enhancements: